<?php $this->load->view('layout/header'); ?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li><a href="javascript:;">商品管理</a></li>
            <li class="active"><a href="javascript:;">添加关键词</a></li>
        </ul>
        <?php echo execute_alert_message() ?>
        <div class="product-alls">
            <div class="product-fonter">新增关键词</div>
            <form class="form-horizontal" action="<?php echo site_url('tourismkeyword/addPost');?>" method="post" id="keyword_add">
                <div class="form-group">
                    <label class="col-sm-2 control-label">关键词名称</label>
                    <div class="col-xs-6">
                         <input type="text" class="form-control required" name="keyword" placeholder="关键词" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-xs-6">
                         <input type="text" class="form-control required number" name="sort" placeholder="排序,越大越前" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>
                    <div class="col-xs-6">
                        <label class="radio-inline">
                            <input type="radio" name="status" value="1" checked="checked"> 启用
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="status" value="0" > 禁用
                        </label>
                    </div>
                </div>
                <div class="form-btn">
                    <a href="javascript:;">
                        <button class="btn btn-info" >保存</button>
                    </a>
                    <a href="<?php echo site_url('tourismkeyword/grid');?>">返回上一步</a>
                </div>
            </form>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer'); ?>
<script type="text/javascript">
jQuery(function(){
	$('form').on('click', '.btn-info', function(event){
	    $('form#keyword_add').validate({
	         rules:{
	        	 keyword : {
	                 remote:{
	                    url  : hostUrl()+'/tourismkeyword/checkNameRepeat',
	                    type : 'get',
	                    dataType : 'json',
	                    data : {
                    	     'keyword' : function(){return $('input[name="keyword"]').val();},
                        } 
	                 }
	             }
	         },
	         messages:{
	        	 keyword :{ remote:'该关键词已经存在'}
	         },
	         submitHandler:function(form) {
	        	 form.submit();
	         }
	    });
	    event.stopPropagation();
	})
})

</script>
